package com.apes.fn.ssm.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.stock.model.Location;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

@Getter
@Setter
@DynamicInsert
@DynamicUpdate
@SelectBeforeUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = CalculatedState.CONST_TABLE_NAME)
public class CalculatedState extends BaseModel {
    public static final String CONST_TABLE_NAME = "mas_calculated_state";

    @Id
    @ApesGenerator(code = CONST_TABLE_NAME, name ="测算完成状态")
    @Comment(value = "编码")
    private String id;

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "location_id", referencedColumnName = "id")
    @Comment(value = "仓库")
    private Location location;

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "fitting_message_id", referencedColumnName = "id")
    @Comment(value = "组合配件")
    private FittingMessage fittingMessage;

    @Column(name = "vip_model", columnDefinition = "number(1,0) default 0")
    @Comment(value = "会员车型")
    private int vipModel;

    @Column(name = "data_center_model_mark", columnDefinition = "number(1,0) default 0")
    @Comment(value = "获取数据中心车型标电子目录")
    private int dataCenterModelMark;

    @Column(name = "data_center_model_mark2", columnDefinition = "number(1,0) default 0")
    @Comment(value = "获取数据中心车型匹配规则")
    private int dataCenterModelMark2;

    @Column(name = "calcu_qualify_mark", columnDefinition = "number(1,0) default 0")
    @Comment(value = "计算排位标记")
    private int calcuQualifyMark;

    @Column(name = "calcu_sales_mark", columnDefinition = "number(1,0) default 0")
    @Comment(value = "计算销量标记")
    private int calcuSalesMark;

    @Column(name = "calcu_coverage_mark", columnDefinition = "number(1,0) default 0")
    @Comment(value = "计算覆盖率标记")
    private int calcuCoverageMark;

    @Column(name = "calcu_stock_pro_mark", columnDefinition = "number(1,0) default 0")
    @Comment(value = "计算备货SKU标记")
    private int calcuStockProMark;

    @Column(name = "calcu_stock_qty_mark", columnDefinition = "number(1,0) default 0")
    @Comment(value = "计算备货数量标记")
    private int calcuStockQtyMak;

    @Column(name = "confirm_complete_mark", columnDefinition = "number(1,0) default 0")
    @Comment(value = "确认测算完毕标记")
    private boolean confirmCompleteMark;

    @Column(name = "step_two_mark", columnDefinition = "number(1,0) default 0")
    @Comment(value = "是否进入第二界面")
    private boolean stepTwoMark;

}
